﻿namespace Sidvall.AuthorizationManager.Data.Entity.Entities
{
    public partial class AuthorizationScopeResourceItem : global::Sidvall.Data.DataRowBase, global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem
    {
        #region Public Members

        #region AccessLevel

        private int _AccessLevel;
        public int AccessLevel
        { 
            get
            {
                return _AccessLevel;
            }
            set
            {
                _AccessLevel = value;
            }
        }

        #endregion
        #region Actions

        private string _Actions;
        public string Actions
        { 
            get
            {
                return _Actions;
            }
            set
            {
                _Actions = value;
            }
        }

        #endregion
        #region AuthorizationScopeId

        private long _AuthorizationScopeId;
        public long AuthorizationScopeId
        { 
            get
            {
                return _AuthorizationScopeId;
            }
            set
            {
                _AuthorizationScopeId = value;
            }
        }

        #endregion
        #region AuthorizationScopeResourceItemId

        private long _AuthorizationScopeResourceItemId;
        public long AuthorizationScopeResourceItemId
        { 
            get
            {
                return _AuthorizationScopeResourceItemId;
            }
            set
            {
                _AuthorizationScopeResourceItemId = value;
            }
        }

        #endregion
        #region IsEnabled

        private bool _IsEnabled;
        public bool IsEnabled
        { 
            get
            {
                return _IsEnabled;
            }
            set
            {
                _IsEnabled = value;
            }
        }

        #endregion
        #region Resource

        private string _Resource;
        public string Resource
        { 
            get
            {
                return _Resource;
            }
            set
            {
                _Resource = value;
            }
        }

        #endregion
        #region ResourceItemId

        private string _ResourceItemId;
        public string ResourceItemId
        { 
            get
            {
                return _ResourceItemId;
            }
            set
            {
                _ResourceItemId = value;
            }
        }

        #endregion
        #region SubActions

        private string _SubActions;
        public string SubActions
        { 
            get
            {
                return _SubActions;
            }
            set
            {
                _SubActions = value;
            }
        }

        #endregion
        
        public virtual Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScope AuthorizationScope { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual System.Collections.Generic.ICollection<Sidvall.AuthorizationManager.Data.Entity.Entities.AuthorizationScopeResourceItemClaim> AuthorizationScopeResourceItemClaim { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.AuthorizationManager.Data.Entity.SystemContext.Current.EntityFacade.AuthorizationScopeResourceItemManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.AuthorizationManager.Data.Entity.SystemContext.Current.EntityFacade.AuthorizationScopeResourceItemManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region IAuthorizationScopeResourceItem Members

        global::Sidvall.AuthorizationManager.Data.ResourceAccessLevel global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.AccessLevel
        {
            get
            {
                return (global::Sidvall.AuthorizationManager.Data.ResourceAccessLevel)this._AccessLevel;
            }
            set
            {
                this.AccessLevel = (int)value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.Actions
        {
            get
            {
                return this._Actions;
            }
            set
            {
                this.Actions = value;
            }
        }
        long global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.AuthorizationScopeId
        {
            get
            {
                return this._AuthorizationScopeId;
            }
            set
            {
                this.AuthorizationScopeId = value;
            }
        }
        System.Nullable<long> global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.AuthorizationScopeResourceItemId
        {
            get
            {
                return this._AuthorizationScopeResourceItemId;
            }
            set
            {
                if (value != null)
                    this.AuthorizationScopeResourceItemId = value.Value;
            }
        }
        bool global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.IsEnabled
        {
            get
            {
                return this._IsEnabled;
            }
            set
            {
                this.IsEnabled = value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.Resource
        {
            get
            {
                return this._Resource;
            }
            set
            {
                this.Resource = value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.ResourceItemId
        {
            get
            {
                return this._ResourceItemId;
            }
            set
            {
                this.ResourceItemId = value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.SubActions
        {
            get
            {
                return this._SubActions;
            }
            set
            {
                this.SubActions = value;
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        IAuthorizationScope global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.AuthorizationScope
        {
            get
            {
                return this.AuthorizationScope;
            }
            set
            {
                this.AuthorizationScope = value as AuthorizationScope;
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        System.Collections.Generic.IEnumerable<IAuthorizationScopeResourceItemClaim> global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.AuthorizationScopeResourceItemClaims
        {
            get
            {
                return this.AuthorizationScopeResourceItemClaim;
            }
        }
        void global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem.SetAuthorizationScopeResourceItemClaims(Sidvall.Data.IDataRowProvider<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItemClaim> items)
        {
            this.AuthorizationScopeResourceItemClaim = items as AuthorizationScopeResourceItemClaimCollection;
        }

        #endregion

        #endregion
        #region Constructors

        public AuthorizationScopeResourceItem() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public AuthorizationScopeResourceItem(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
                this.AuthorizationScopeResourceItemClaim = new System.Collections.Generic.List<AuthorizationScopeResourceItemClaim>();
            }
        }

        #endregion
    }
}